package com.yzsj.socket;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


/**
 * @author wjl
 */
@RestController
@EnableTransactionManagement
@ServletComponentScan
@MapperScan("com.yzsj.socket.business.dao")
@SpringBootApplication
@EnableScheduling
public class SocketApplication extends WebMvcConfigurerAdapter {


    public static void main(String[] args) {
        SpringApplication.run(SocketApplication.class, args);
    }

    /**
     * @Description 跨域请求配置，支持前后端分离场景
     * @params [registry]
     * @return void
     * @UpdateUser
     * @UpdateDate
     * @Author liqiaozong
     * @Date 2019-03-28 14:11
     **/
    @Override
    public void addCorsMappings(CorsRegistry registry){
        registry.addMapping("/**")
                .allowCredentials(true)
                .allowedHeaders("*")
                .allowedOrigins("*")
                .allowedMethods("*");
    }

}
